<!--
 * @Author: your name
 * @Date: 2022-04-11 12:54:50
 * @LastEditTime: 2022-04-17 23:34:00
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /vue/src/pages/Main/Main.vue
-->
<script lang="ts" setup>
import { getMsg } from '@/http/api/login'
import {useStore} from '@/store/store'

const mainStore = useStore()

const updateName = () => {
  // $patch 修改 store 中的数据
  mainStore.$patch({
    name: '名称被修改了,nameLength也随之改变了'
  })
}

const getdata=()=>{
  getMsg().then((res:any)=>{
    console.log(res)
    console.log('测试')
  })

}
</script>
<template>
  <div class="main">
    <div>用户名:{{ mainStore.name }}<br/>长度:{{ mainStore.nameLength }}</div>
    <hr/>
    <el-button @click="updateName">修改store中的name</el-button>
    <!-- <el-button @click="()=>this.$router.push('/')">返回首页</el-button> -->
<button @click="getdata">测试</button>
  </div>



</template>
<style scoped>

</style>
